package com.sec.etech.form.cust.controller;

import com.alibaba.fastjson.JSONObject;
import com.sec.etech.form.cust.service.EtechFormCustSqlManager;
import org.openbpm.base.api.aop.annotion.CatchErr;
import org.openbpm.base.api.response.impl.ResultMsg;
import org.openbpm.form.model.custsql.FormCustSql;
import org.openbpm.form.rest.controller.FormCustSqlController;
import org.openbpm.form.util.JSONObjectUtil;
import org.openbpm.form.vo.SqlFieldsVO;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;


@RestController
@RequestMapping({"/etech/formCustSql"})
public class EtechFormCustSqlController extends FormCustSqlController {

    @Resource
    private EtechFormCustSqlManager etechFormCustSqlManager;

    @RequestMapping({"/parseSql"})
    @CatchErr
    public ResultMsg<List<SqlFieldsVO>> parseSql(@RequestBody FormCustSql formCustSql) throws Exception {
        return  etechFormCustSqlManager.parseSql(formCustSql);
    }

    @RequestMapping({"/save"})
    @CatchErr
    public ResultMsg<String> save(@RequestBody FormCustSql formCustSql) throws Exception {
        return etechFormCustSqlManager.save(formCustSql);
    }
}
